package nobu.nakata.nfcfare.resource.mapper;

import javax.jdo.PersistenceManager;

import net.sf.jsr107cache.Cache;
import nobu.nakata.nfcfare.resource.item.IBusResourceItem;
import nobu.nakata.nfcfare.resource.mapper.strategy.BusCaching;
import nobu.nakata.nfcfare.resource.mapper.strategy.BusPersistence;
import nobu.nakata.nfcfare.table.BusStation;
import nobu.nakata.nfcfare.table.BusStationHistory;

import com.google.appengine.api.users.User;


public class BusResourceMapper {
	private ResourceMapper<BusStation, BusStationHistory, IBusResourceItem, Long> mapper;
	
	
	public BusResourceMapper(Cache cache, PersistenceManager pm, User viewer) {
		this.mapper		= new ResourceMapper<BusStation, BusStationHistory, IBusResourceItem, Long>(
				new BusCaching(cache), new BusPersistence(cache, pm, viewer));
	}

	
	public IBusResourceItem findByTrainStationCode(long busCode) {
		return mapper.findByKey(busCode);
	}
	public void set(IBusResourceItem item) {
		mapper.set(item);
	}
}
